CPPFLAGS+= -I $R/osswresources/ercos_osswr/include

# Label SRCS contains a list of all the source files that are to be compiled
# following the rules specifies by the chosen platform. All the source files
# included in this list are going to be compiled and linked to create the
# project executable. A common example of use for this label would be:
# 
# SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/*.c)
# 
# The previous line would include in the list all the source files contained
# in the source root folder.

# PROTECTED REGION ID(ercos_osswr_common_src) ENABLED START

SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/*.c)
SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/*.cpp)
SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/posix/*.c)

# PROTECTED REGION END

# It is also possible to perform a selective compilation of source files 
# depending on the platform for which the resource is compiled by using
# the flags defined by the framework at configuration time. These flags have a
# known syntax.


ifeq ($(CONFIG_ARCH_SPARC), y)
# List of files to compile if the destination architecture is
# SPARC

# PROTECTED REGION ID(ercos_osswr_architecture_sparc) ENABLED START

CPPFLAGS+= -I $R/osswresources/ercos_osswr/include/ercos/hals/sparc

SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/hals/sparc/*.c)
SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/hals/sparc/*.S)

# PROTECTED REGION END

ifeq ($(CONFIG_MP_ERC32), y)
# List of files to compile if the destination architecture is
# SPARC and the destination microprocessor is ERC32

# PROTECTED REGION ID(ercos_osswr_architecture_sparc_microprocessor_erc32) ENABLED START
CPPFLAGS+= -I $R/osswresources/ercos_osswr/include/ercos/hals/sparc/erc32

SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/hals/sparc/erc32/*.c)
SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/hals/sparc/erc32/gdebug.S)

ifeq ($(CONFIG_BOARD_CPU_MICROSAT), y)
SRCS+=$R/osswresources/ercos_osswr/src/hals/sparc/erc32/microsat/usat_crt0.S
else
SRCS+=$R/osswresources/ercos_osswr/src/hals/sparc/erc32/standard_board/crt0.S
endif

LDSCRIPT_IN:=$R/osswresources/ercos_osswr/src/hals/sparc/erc32/link.in
LDSCRIPT:=$(patsubst %.in,%.ld,$(LDSCRIPT_IN))

LDFLAGS+= -M -T $(LDSCRIPT)
ASMFLAGS+= -DST_DIV0=0x2 -DASM -DASSEMBLY

# PROTECTED REGION END

endif	#CONFIG_MP_ERC32

ifeq ($(CONFIG_MP_LEON2), y)
# List of files to compile if the destination architecture is
# SPARC and the destination microprocessor is LEON2

# PROTECTED REGION ID(ercos_osswr_architecture_sparc_microprocessor_leon2) ENABLED START
CPPFLAGS+= -I $R/osswresources/ercos_osswr/include/ercos/hals/sparc/leon2

SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/hals/sparc/leon2/*.c)

ifeq ($(CONFIG_PLATFORM_GRMON_USED), y)
SRCS+=$R/osswresources/ercos_osswr/src/hals/sparc/leon2/grmon/crt0.S
else
SRCS+=$R/osswresources/ercos_osswr/src/hals/sparc/leon2/no-grmon/crt0.S
endif

LDSCRIPT_IN:=$R/osswresources/ercos_osswr/src/hals/sparc/leon2/link.in
LDSCRIPT:=$(patsubst %.in,%.ld,$(LDSCRIPT_IN))

LDFLAGS+= -M -T $(LDSCRIPT)
ASMFLAGS+= -DST_DIV0=0x2 -DASM -DASSEMBLY

# PROTECTED REGION END

endif	#CONFIG_MP_LEON2

ifeq ($(CONFIG_MP_LEON3), y)
# List of files to compile if the destination architecture is
# SPARC and the destination microprocessor is LEON3

# PROTECTED REGION ID(ercos_osswr_architecture_sparc_microprocessor_leon3) ENABLED START
CPPFLAGS+= -I $R/osswresources/ercos_osswr/include/ercos/hals/sparc/leon3

SRCS+=$(wildcard $R/osswresources/ercos_osswr/src/hals/sparc/leon3/*.c)

#ifeq ($(CONFIG_PLATFORM_GRMON_USED), y)
SRCS+=$R/osswresources/ercos_osswr/src/hals/sparc/leon3/grmon/crt0.S
#else
#SRCS+=$R/osswresources/ercos_osswr/src/hals/sparc/leon3/no-grmon/crt0.S
#endif

LDSCRIPT_IN:=$R/osswresources/ercos_osswr/src/hals/sparc/leon3/link.in
LDSCRIPT:=$(patsubst %.in,%.ld,$(LDSCRIPT_IN))

LDFLAGS+= -M -T $(LDSCRIPT)
ASMFLAGS+= -DST_DIV0=0x2 -DASM -DASSEMBLY


# PROTECTED REGION END

endif	#CONFIG_MP_LEON3

endif	#CONFIG_ARCH_SPARC


# It is also possible to create one or more targets to be executed before the
# compilation process. These targets should be included in the list:
# ALT_TARGETS+=

# Also, all the usual compilation and linking flags, like CFLAGS or LDFLAGS are
# available to be used. If you want to set an specific set of compilation flags
# for a certain number of source files, you should define the targets for those
# files in this very file, so that the framework will not use the default ones.

# All the configuration parameters defined for the resource can be used as
# flags for a conditional compilation. A parameter name called PARAMETER_NAME
# defines a label named CONFIG_PARAMETER_NAME whose value can be checked.

